package com.base.taskreports.reports.service.impl;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.base.taskreports.common.utlis.DateUtil;
import com.base.taskreports.common.utlis.TableNameUtil;
import com.base.taskreports.reports.dao.jfu.TblCqpntPointOutFlowDao;
import com.base.taskreports.reports.entiyt.jfu.TblCqpntPointOutFlowEnyity;
import com.base.taskreports.reports.service.TblCqpntPointOutFlowService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 张玉涛
 * @since 2021-11-09
 */
@DS("jfu")
@Service("tblCqpntPointOutFlowService")
public class TblCqpntPointOutFlowServiceImpl extends ServiceImpl<TblCqpntPointOutFlowDao, TblCqpntPointOutFlowEnyity> implements TblCqpntPointOutFlowService {

	
	@Autowired(required=true)
	private TblCqpntPointOutFlowDao tblCqpntPointOutFlowDao;

	
	/**
     * 积分-用分tbl_cqpnt_point_out_flow01
     */
    public static final String JFYF = "tbl_cqpnt_point_out_flow";
    

    
	//外部积分（转接/兑换）承兑金额浮动告警(不用)
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectExternalIntegralAcceptanceAmountFloatingAlarm(String dateTime) {
		  
		return null;
	}
	//比率指标监控	外部积分（转接/兑换）承兑金额浮动告警
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectRatioIndicatorMonitorsFloatingAlarmOfExternalIntegralAcceptanceAmount(String DateTime) {
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectRatioIndicatorMonitorsFloatingAlarmOfExternalIntegralAcceptanceAmount();
		return tblCqpntPointOutFlowList;
	}
	//各积分类别消费中各支付产品类型笔数占比浮动
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectFloatingProportionOfTheNumberOfPaymentProductsIConsumptionOfEachCreditCategory(String DateTime) {
		
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
	
		//查询支付产品类型笔数
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectFloatingProportionOfTheNumberOfPaymentProductsIConsumptionOfEachCreditCategory(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
	//各积分类别消费中各支付产品类型金额占比浮动
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectFloatingProportionProductTypeConsumptionRachCreditCategory(String DateTime) {
		
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
		//查询支付产品类型金额
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectFloatingProportionProductTypeConsumptionRachCreditCategory(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
	//积分撤销/冲正/退货反向交易笔数占比浮动
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectFloatingProportionAmountRachTypeProductPaidConsumptionPointsNumberTransaction(String DateTime) {
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectFloatingProportionAmountRachTypeProductPaidConsumptionPointsNumberTransaction(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
	//积分撤销/冲正/退货反向交易金额占比浮动
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectTheProportionOfReverseTransactionAmountIntegralRevocationFluctuates(String DateTime) {
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectTheProportionOfReverseTransactionAmountIntegralRevocationFluctuates(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));

		return tblCqpntPointOutFlowList;
	}
	//营销系统系统成功率
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectMarketingSystemCuccessRate(String DateTime) {
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
				
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectMarketingSystemCuccessRate(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
	//积分兑换价值比不为1笔数
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectTheConversionValueRatioOfPointsIsNotSingleNumber(String DateTime) {
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(DateTime,JFYF);
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectTheConversionValueRatioOfPointsIsNotSingleNumber(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
	

	//积分兑换价值比不为1笔数 //前50笔
	@Override
	public List<TblCqpntPointOutFlowEnyity> selectTheTopFiftyTheConversionValueRatioOfPointsIsNotSingleNumber(
			String dateTime) {
		Map<String, String> dayUtlis = TableNameUtil.dayUtlis(dateTime,JFYF);
		List<TblCqpntPointOutFlowEnyity> tblCqpntPointOutFlowList = tblCqpntPointOutFlowDao.selectTheTopFiftyTheConversionValueRatioOfPointsIsNotSingleNumber(
				dayUtlis.get("jfsfzDayTabName"),
				dayUtlis.get("yestoyyyymmddday"),
				dayUtlis.get("floSt"));
		return tblCqpntPointOutFlowList;
	}
}
